package com.itfenghuang.day06;

import java.util.*;

public class A05_课下作业 {
    public static void main(String[] args) {
//        1.已知一个集合容器ArrayList中 存储了"aaa" "bbb" "ccc" "aaa" "aaa",
//            要求删除所有的"aaa"

        ArrayList<String> str = new ArrayList<>();
        str.add("aaa");
        str.add("bbb");
        str.add("ccc");
        str.add("aaa");
        str.add("aaa");
//        for (int i = 0; i < str.size(); i++) {
//            if ("aaa".equals(str.get(i))){
//                str.remove(i);
//                i--;
//            }
//        }
//        System.out.println(str);


//        Iterator<String> iterator = str.iterator();
//        while (iterator.hasNext()){
//            String next = iterator.next();
////           System.out.println(next);//集合中的元素
//            if ("aaa".equals(next)){
//                iterator.remove();
//            }
//        }
//        System.out.println(str);



        char [] chs={'A','B','C','D','E','F','G','H','I','J','K','L','M','N',
                'O','P','Q','R','S','T','U','V','W','X','Y','Z'};
        //实际参数
//        String str=getStr(chs);
//        System.out.println(str);
    }
//    public static String getStr(char[] chs){
//        String str="";
//        Random random = new Random();
//        for (int i = 0; i < 4; i++) {
//            int t = random.nextInt(26);
//            str+=chs[t];
//        }
//        int anInt = random.nextInt(10);
//        str+=anInt;
//        return str;
//    }

}

class Studenttt implements Comparable<Studenttt>{
    private String id;
    private String name;
    private String height;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHeight() {
        return height;
    }

    public void setHeight(String height) {
        this.height = height;
    }

    public Studenttt() {
    }

    public Studenttt(String id, String name, String height) {
        this.id = id;
        this.name = name;
        this.height = height;
    }

    @Override
    public String toString() {
        return "Studenttt{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", height='" + height + '\'' +
                '}';
    }

    @Override
    public int compareTo(Studenttt o) {
        return 0;
    }
}
class MainApp extends Studenttt{
    public static void main(String[] args) {
        Studenttt stu1 = new Studenttt("a001","黄渤","1.72");
        Studenttt stu2 = new Studenttt("a002","孙红雷","1.78");
        Studenttt stu3 = new Studenttt("a003","章子怡","1.64");
        Studenttt stu4 = new Studenttt("a004","杨颖","1.68");
        Studenttt stu = new Studenttt("a005","撒贝宁","1.67");


        ArrayList<Studenttt> obj = new ArrayList<>();
        obj.add(stu);
        obj.add(stu1);
        obj.add(stu2);
        obj.add(stu3);
        obj.add(stu4);

        for (int i = 0; i < obj.size(); i++) {
            System.out.println(obj.get(i));
        }
        System.out.println(obj.get(2));
        System.out.println(obj.remove(3));
        System.out.println(obj.set(0, stu));
        System.out.println("===================");

        for (Studenttt studenttt : obj) {
//            if (studenttt.getHeight()>1.7){
//                System.out.println(studenttt);
//            }
        }

        for (Studenttt studenttt : obj) {

        }


        }


    }

